package com.meituan.stock.api.http.model.converter;

import com.meituan.stock.api.http.model.request.InStockHttpRequest;
import com.meituan.stock.api.http.model.request.InitStockHttpRequest;
import com.meituan.stock.api.http.model.request.OutStockHttpRequest;
import com.meituan.stock.biz.model.bo.StockBO;

/**
 * @author ShenWenhao
 * @Created by ShenWenhao
 * @Date 2022/5/9 16:59
 */
public class StockBOConverter {

    public static StockBO fromInitStockHttpRequest(InitStockHttpRequest initStockHttpRequest){
        StockBO stockBO = new StockBO();
        stockBO.setGoodId(initStockHttpRequest.getGoodId());
        stockBO.setWarehouseId(initStockHttpRequest.getWarehouseId());
        stockBO.setMoney(initStockHttpRequest.getMoney());
        stockBO.setAccount(initStockHttpRequest.getAccount());
        return stockBO;
    }

    public static StockBO fromId(Long id){
        StockBO stockBO = new StockBO();
        stockBO.setId(id);
        return stockBO;
    }

    public static StockBO fromInStockHttpRequest(InStockHttpRequest inStockHttpRequest){
        StockBO stockBO = new StockBO();
        stockBO.setId(inStockHttpRequest.getId());
        stockBO.setAccount(inStockHttpRequest.getAccount());
        stockBO.setMoney(inStockHttpRequest.getMoney());
        return stockBO;
    }

    public static StockBO fromOutStockHttpRequest(OutStockHttpRequest outStockHttpRequest){
        StockBO stockBO = new StockBO();
        stockBO.setId(outStockHttpRequest.getId());
        stockBO.setAccount(outStockHttpRequest.getAccount());
        stockBO.setMoney(outStockHttpRequest.getMoney());
        return stockBO;
    }
}
